Skip to content

Add support for imagefs and fix multi-stage cache probing#25

Merged
mafredri merged 13 commits into
mainfrom
mafredri/multistage-cache-probing-vfs
Aug 29, 2024
Merged

Add support for imagefs and fix multi-stage cache probing#25
mafredri merged 13 commits into
mainfrom
mafredri/multistage-cache-probing-vfs

Conversation

@mafredri
Copy link
Copy Markdown
Member

This PR adds support for imagefs which currently only supports pre-caching requested files. This means that Dockerfile instructions are resolved ahead of time to figure out which files to cache.

This allows tar archives to be walked once and since files are hashed as-we-go, the implementation is also memory efficient.

Once envbuilder updates to this fork, tha issue coder/envbuilder#230 will be resolved.

Comment thread pkg/executor/build.go
Comment thread pkg/executor/build.go
Comment thread pkg/executor/build.go Outdated
Comment thread pkg/util/util.go
Comment thread pkg/imagefs/imagefs.go Outdated
Comment thread pkg/imagefs/imagefs.go Outdated
Comment thread pkg/imagefs/imagefs.go
Comment thread pkg/imagefs/imagefs.go Outdated
Comment thread pkg/executor/build.go
Comment thread pkg/imagefs/imagefs.go
Comment thread pkg/imagefs/imagefs.go Outdated
Comment thread pkg/imagefs/imagefs.go Outdated
Comment thread pkg/imagefs/imagefs.go Outdated
Comment thread pkg/executor/build.go Outdated
Comment thread pkg/executor/build_test.go
args: args{
dockerfile: `
FROM scratch as target
COPY --from=alpine /etc/alpine-release /etc/alpine-release
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: have you tried implementing more tests?

  1. FROM three different image.
  2. Copy symlink.
  3. Overwriting a file FROM first image with the file FROM the second image.
  4. Image with cycle symlink inside.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I enabled the disabled TestDoCacheProbe/MultiStage test and added a symlink copy. This tests the basics of cache probe for multi-stage. We'll do more integration testing in envbuilder.

Copy link
Copy Markdown
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Nice work!

Comment thread pkg/executor/build.go Outdated
Comment thread pkg/executor/build.go Outdated
mafredri and others added 2 commits August 27, 2024 16:01
Copy link
Copy Markdown
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go!

@mafredri mafredri changed the title Add support for imagefs and fix multi stage cache probing Add support for imagefs and fix multi-stage cache probing Aug 29, 2024
@mafredri mafredri merged commit 8cd5f9f into main Aug 29, 2024
@mafredri mafredri deleted the mafredri/multistage-cache-probing-vfs branch August 29, 2024 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants